<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>PHP中文网介绍</h2>
<ul>
    <li><a href="file/html/about.html">网站宗旨</a></li>
    <li><a href="file/html/lesson.html">学习课程</a></li>
    <li><a href="file/html/connect.html">联系我们</a></li>
</ul>
<div id="content"></div>
</body>
<script>
    window.onload = function () {
        //获取页面a元素，返回对象数组
        let aNodes = document.getElementsByTagName('a');
        let content = document.getElementById('content');

        for (let i=0; i<aNodes.length; i++){
            aNodes[i].onclick = function(){
                let request = new XMLHttpRequest();
                request.open('GET',this.href+'?='+(new Date()),true);
                request.send(null);
                request.onreadystatechange = function () {
                    if (request.status == 200 && request.readyState==4){
                        content.innerHTML = request.responseText;
                    }
                }
                return false;
            }
        }
    }
</script>
</html>